var pathName = document.location.pathname;
	var index = pathName.substr(1).indexOf("/");
	var result = pathName.substr(0,index+1);
	var url = decodeURI(location.search);
	var epId = url.substr(6);
	$(function(){
		$.ajax({
			url:result+"/pro/view",
			data:"epId="+epId,
			dataType:"json",
			type:"get",
			success:function(data){
				if(data.success){
					$("#epId").val(data.data.epId);
					$("#epName").val(data.data.epName);
					$("[name='epcChildId']").val(data.data.epcChildId);
					$("#epPrice").val(data.data.epPrice);
					$("#epDescription").val(data.data.epDescription);
					$("#epStock").val(data.data.epStock);
				}else{
					alert(data.message);
				}
			},
			error:function(){
				alert("服务器出现错误，请联系网站管理员");
			}
		})
	}) 
	
	$(function(){
		var pathName = document.location.pathname;
		var index = pathName.substr(1).indexOf("/");
		var result = pathName.substr(0,index+1);
		$("#dataForm").submit(function(){
				$(this).ajaxSubmit({
					url:result+"/pro/update",
					type:"post",
					dataType:"json",
					success:function(data){
						if(data.success){
							alert(data.message);
							location.href="product.html";
						}else{
							alert(data.msg);
						}
					},error:function(){
						alert("添加信息请求处理异常");
					}
				})
				return false;
		})
})